package com.kuang.controller;

import com.kuang.pojo.Manager;
import com.kuang.service.LoginService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/login")
public class LoginController {

    @Resource
    private LoginService loginService;

    /*@RequestMapping("/check")
    public String checkManager(@RequestParam("mgrname") String mgrname,@RequestParam("mgrpassword") String mgrpassword){
        System.out.println(mgrname+mgrpassword);
        if (loginService.queryManager(mgrname,mgrpassword)!=null){
            return "hello";
        }else {
            return null;
        }
    }*/

    @RequestMapping("/check")
    public String checkManager(Manager manager){
        System.out.println(manager);
        if (loginService.queryManager(manager.getMgrname(),manager.getMgrpassword())!=null){
            return "/hello";
        }else {
            return null;
        }
    }
}
